package com.fl.chinesemedicen;

import android.app.ActionBar;
import android.app.Activity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.method.ScrollingMovementMethod;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.RotateAnimation;
import android.widget.ImageView;
import android.widget.TextView;

import com.fl.chinesemedicen.util.Globals;

public class AcupointActivity extends Activity {
    private ImageView iv;
    private TextView name;
    private TextView position;
    private TextView waytoget;
    private TextView effective;
    private TextView attending;
    private TextView clinical;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_acupoint);
        ActionBar actionBar = getActionBar();
        if(actionBar!=null){
            actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
            actionBar.setCustomView(R.layout.bar);
            iv = (ImageView) actionBar.getCustomView().findViewById(R.id.iv_bar);
            iv.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    RotateAnimation rotateAnimation = new RotateAnimation(0,720, Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f);
                    rotateAnimation.setDuration(2000);
                    iv.startAnimation(rotateAnimation);
                }
            });
        }
        initView();
        name.setText(Globals.ac.getName());
        position.setText(Globals.ac.getPosition());
        waytoget.setText(Globals.ac.getWaytoget());
        effective.setText(Globals.ac.getEffective());
        attending.setText(Globals.ac.getAttending());
        clinical.setText(Globals.ac.getClinical());
    }
    private void initView(){
        name = (TextView) findViewById(R.id.acu_name);
        position = (TextView) findViewById(R.id.tv_position);
        waytoget = (TextView) findViewById(R.id.tv_waytoget);
        effective = (TextView) findViewById(R.id.tv_effective);
        attending = (TextView) findViewById(R.id.tv_attending);
        clinical = (TextView) findViewById(R.id.tv_clinical);
        clinical.setMovementMethod(ScrollingMovementMethod.getInstance());
    }
}
